package cn.mall.framework.wxsdk.core.msg;

import lombok.Data;

/**
 * 微信模板消息
 */
@Data
public class Template {

    /** 模板字段名称 */
    private String name;
    /** 显示颜色 */
    private String color;
    /** 显示数据 */
    private String value;

    public Template() {
    	this(null,"#119EF3",null);
    }

    public Template(String name, String color, String value) {
        this.name = name;
        this.color = color;
        this.value = value;
    }

    /**
     * 组装模板数据
     */
    public String templateData() {
        StringBuffer data = new StringBuffer("\"" + name + "\":{");
        data.append("\"value\":\"").append(value).append("\",");
        data.append("\"color\":").append(color).append("\"}");
        return data.toString();
    }

}
